#ifndef __UTILS_H__
#define __UTILS_H__

#ifdef CLE_NAMESPACE
namespace utils {
#endif

#define min(a,b)         (a < b ? a : b)
#define max(a,b)         (a > b ? a : b)

GPoint       getPosFromRect(const GRect& rc, const GPoint& pt, const GSize& cell);

bool            isOperator(int ch);

char            upperCase(char c);
char            lowerCase(char c);

int             num2string(int num, char *buffer);
int             string2num(const char* str, int len);
void            reverseString(char* s, int len);

const char*     next_character(const char* str, int encoding = 0);
const char*     last_character(const char* phead, const char* pcur ,int encoding = 0 );
int             ucs2_ascii(const wchar_t* str, int len, char* buf);

#ifdef CLE_NAMESPACE
}
#endif

#endif